<?php


/**
 * Class WebsocketServer
 */
class WebsocketServer
{
    /**
     * @var int
     */
    private $port = 9000;
    /**
     * @var string
     */
    private $addr = '127.0.0.1';
    /**
     * @var
     */
    private $socket_handler;
    private $back_log = 10;
    private $websocket_key;
    private $current_message_length;
    private $is_shakehanded = false;
    private $mask_key;

    /**
     * WebsocketServer constructor.
     * @param int $port
     * @param string $addr
     * @param $socket_handler
     * @param int $back_log
     */
    public function __construct(int $port=8080, string $addr="127.0.0.1", $socket_handler=10)
    {
        $this->port = $port;
        $this->addr = $addr;
        $this->socket_handler = $socket_handler;
    }


    /**
     *throw Exception
     */
    public function createSocket(){
        $this->socket_handler= socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
        if (!$this->socket_handler){
            throw new Exception("");
        }
    }


}